<!--import '../../src/xzbus/css/cas,css'-->

<template>
  <div id="container">
    <span class="divide"><img style="margin-top: 22px;" id="logo-img" alt="" src="../../src/assets/logo.png"></span>
    <span class="title">|</span>
    <span class="title">企业管理平台</span>
    <header style="margin-top: 10%">
      <h1>小猪图</h1>
    </header>
    <section class="row" id="login">
      <label for="username">用户名:</label>
      <input id="userName" v-model="account" name="userName" class="required" tabindex="1" placeholder="用户名"
             accesskey="n" type="text" value="" size="25" autocomplete="off" maxlength="20"
             oninput="this.value=this.value.replace(/[\u4e00-\u9fa5]/g,'');" value="">
      <label for="password">密　码:</label>
      <input id="password" v-model="password" name="password" class="required" tabindex="2" placeholder="密　码"
             accesskey="p" type="password" value="" size="25" autocomplete="off" maxlength="20">
      <div v-model="message" id="errMsg" style="color:red; margin-top:12px;text-align: center"></div>
      <input class="btn-submit" name="submit" readonly="readonly" accesskey="l" value="登录" tabindex="6" @click="login"/>
    </section>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        account: '',
        password: '',
        message: ''
      }
    },
    methods: {
      login() {
        let params = {
          userName: this.account,
          password: this.password
        }
        /*    this.$http.post('/es/api/system/login', params)
              .then((response) => {
                // 响应成功回调
                console.log(response)
                if (!response.error) {
                  this.$router.replace({
                    path: '/index'
                  })
                  // 获取登录信息
                  return this.$http.get('/es/api/system/me')

                } else {
                  this.message = '用户名或密码错误'
                }
              })
              .then((response) => {
                console.log(response)
              })
              .catch((reject) => {
                console.log(reject)
              })*/
        this.$router.replace({
          path: '/index'
        })
      }
    }
  }
</script>
<style>
  /*  背景图片*/
  html {
    margin: 0 auto;
    height: 100%;
    background: url(../../src/assets/bg-l.png) no-repeat;
    background-size: cover;
    width: 100%;
    display: table;
    /* padding-top: 80px; */
  }
</style>
<style scoped>
  /*logo文字*/
  .title {
    display: inline-block;
    color: #A2A2A2;
    vertical-align: middle;
    font-size: 30px;
    margin-bottom: 50px;
    margin-left: 10px;
  }

  /*logo图片*/
  .divide {
    margin-left: 55px;

  }

  /*小猪图标*/
  header h1 {
    margin: 0 auto;
    width: 100px;
    height: 100px;
    background: url(../../src/assets/pig-logo.png) no-repeat;
    background-size: 100% 100%;
    text-indent: -999em;
  }

  /*输入框*/
  #login {
    width: 30%;
    max-width: 570px;
    margin: 0 auto;
  }

  #login h2 {
    display: none;
  }

  #login .row {
  }

  #login label {
    display: block;
    margin-bottom: 2px;
    display: none;
  }

  #login .check label {
    display: inline;
  }

  #login input[type=text], #login input[type=password] {
    font-size: 24px;
    padding: 5px;
    box-sizing: border-box;
    width: 100%;
    height: 70px;
    border: none;
    background: transparent;
    border-bottom: 1px solid rgba(225, 255, 255, 0.3);
    color: #fff;
    outline: none;
  }

  #login #authcode {
    width: 64%;
    float: left;
    border-radius: 4px 0 0 4px;
  }

  #login .btn-reset {
    background: #eee;
    padding: 10px 20px;
    border: 0;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    width: 48%;
    float: right;
  }

  #login .btn-submit:hover, #login .btn-reset:hover {
    cursor: pointer;
  }

  #login :hover {
    background: #7fd36e;
  }

  #login .btn-reset:hover {
    background: #d4d4d4;
  }

  #login {
    text-align: center;
  }

  #login .btn-submit {
    margin-top: 55px;
    font-size: 24px;
    text-align: center;
    background: #70ba61;
    border: 0;
    padding: 8px 40px;
    font-weight: normal;
    color: white;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 6px;
  }

  /*错误提示*/

  .errors {
    border: 1px dotted #BB0000;
    color: #BB0000;
    padding-left: 100px;
    padding-top: 5px;
    margin-bottom: 5px;
    /*     background: url(../images/error.png) no-repeat 20px center; */
  }
</style>
